# Maintainer: Alexey Pavlov <alexpux@gmail.com>

_realname=Net-SSLeay
pkgname=perl-${_realname}
pkgver=1.88
pkgrel=1
pkgdesc="Perl extension for using OpenSSL"
arch=('i686' 'x86_64')
license=('custom:BSD')
url="https://metacpan.org/${_realname}/"
groups=('perl-modules')
makedepends=('openssl-devel')
depends=('openssl')
options=(!emptydirs)
replaces=('net-ssleay')
provides=('net-ssleay')
source=("https://cpan.metacpan.org/authors/id/C/CH/CHRISN/${_realname}-${pkgver}.tar.gz"
        'Net-SSLeay-1.55.patch')
sha256sums=('2000da483c8471a0b61e06959e92a6fca7b9e40586d5c828de977d3d2081cfdd'
            'a81e528372aeae3d47585260e317f40f80d786fe56d295a1b0c63e90275159d3')

prepare() {
  cd ${srcdir}/${_realname}-${pkgver}

  patch -p1 -i ${srcdir}/Net-SSLeay-1.55.patch
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}

  export OPTIMIZE="$CFLAGS"
  export OPENSSL_PREFIX=/usr

  # install module in vendor directories.
  PERL_MM_USE_DEFAULT=1 perl Makefile.PL -- INSTALLDIRS=vendor
  make
}

package() {
  cd ${srcdir}/${_realname}-${pkgver}

  make install DESTDIR=${pkgdir}
  install -D -m644 README "${pkgdir}/usr/share/licenses/${pkgname}/LICENSE"
}
